<template>
  <div class="settings">
    <van-nav-bar safe-area-inset-top placeholder title="Testing" left-arrow fixed @click-left="onClickLeft">
      <template #right>
        <van-icon name="replay" size="24" @click="reset" />
      </template>
    </van-nav-bar>
    <div class="marginTop15">
      <div class="timeBox">
        <div>Time</div>
        <div>{{myMinute>9?myMinute:'0'+myMinute}}:{{mySecond>9?mySecond:'0'+mySecond}}</div>
      </div>
      <van-collapse v-model="activeNames">
        <van-collapse-item title="Phase R" name="1">
          <van-row class="rowH">
            <van-col span="4">Items:</van-col>
            <van-col span="5">59.S1</van-col>
            <van-col span="5">59.S2</van-col>
            <van-col span="5">27.S1</van-col>
            <van-col span="5">27.S2</van-col>
          </van-row>
          <van-row gutter="10" class="rowH2">
            <van-col span="4">Vt:</van-col>
            <van-col span="5"><div class="ipt">{{aR[0] | ifNull('V')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{bR[0] | ifNull('V')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{cR[0] | ifNull('V')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{dR[0] | ifNull('V')}}</div></van-col>
          </van-row>
          <van-row gutter="10" class="rowH2">
            <van-col span="4">Vs:</van-col>
            <van-col span="5"><div class="ipt">{{aR[1] | ifNull('V')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{bR[1] | ifNull('V')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{cR[1] | ifNull('V')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{dR[1] | ifNull('V')}}</div></van-col>
          </van-row>
          <van-row gutter="10" class="rowH2">
            <van-col span="4">Vo:</van-col>
            <van-col span="5"><div class="ipt">{{aR[2] | ifNull('V')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{bR[2] | ifNull('V')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{cR[2] | ifNull('V')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{dR[2] | ifNull('V')}}</div></van-col>
          </van-row>
          <van-row gutter="10" class="rowH2">
            <van-col span="4">Tt:</van-col>
            <van-col span="5"><div class="ipt">{{aR[3] | ifNull('s')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{bR[3] | ifNull('ms')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{cR[3] | ifNull('ms')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{dR[3] | ifNull('ms')}}</div></van-col>
          </van-row>
          <van-row gutter="10" class="rowH2">
            <van-col span="4">To:</van-col>
            <van-col span="5"><div class="ipt">{{aR[4] | ifNull('s')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{bR[4] | ifNull('ms')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{cR[4] | ifNull('ms')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{dR[4] | ifNull('ms')}}</div></van-col>
          </van-row>
          <van-row gutter="10" class="rowH2">
            <van-col span="4">Result:</van-col>
            <van-col span="5"><div class="ipt">{{aR[5] | ifNull}}</div></van-col>
            <van-col span="5"><div class="ipt">{{bR[5] | ifNull}}</div></van-col>
            <van-col span="5"><div class="ipt">{{cR[5] | ifNull}}</div></van-col>
            <van-col span="5"><div class="ipt">{{dR[5] | ifNull}}</div></van-col>
          </van-row>
          <van-divider :style="{borderColor: '#848F88'}"></van-divider>
          <van-row class="rowH">
            <van-col span="4">Items:</van-col>
            <van-col span="5">81&gt;.S1</van-col>
            <van-col span="5">81&lt;.S1</van-col>
            <van-col span="5">81&gt;.S2</van-col>
            <van-col span="5">81&lt;.S2</van-col>
          </van-row>
          <van-row gutter="10" class="rowH2">
            <van-col span="4">Ft:</van-col>
            <van-col span="5"><div class="ipt">{{aR[6] | ifNull('Hz')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{bR[6] | ifNull('Hz')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{cR[6] | ifNull('Hz')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{dR[6] | ifNull('Hz')}}</div></van-col>
          </van-row>
          <van-row gutter="10" class="rowH2">
            <van-col span="4">Fs:</van-col>
            <van-col span="5"><div class="ipt">{{aR[7] | ifNull('Hz')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{bR[7] | ifNull('Hz')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{cR[7] | ifNull('Hz')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{dR[7] | ifNull('Hz')}}</div></van-col>
          </van-row>
          <van-row gutter="10" class="rowH2">
            <van-col span="4">Fo:</van-col>
            <van-col span="5"><div class="ipt">{{aR[8] | ifNull('Hz')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{bR[8] | ifNull('Hz')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{cR[8] | ifNull('Hz')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{dR[8] | ifNull('Hz')}}</div></van-col>
          </van-row>
          <van-row gutter="10" class="rowH2">
            <van-col span="4">Tt:</van-col>
            <van-col span="5"><div class="ipt">{{aR[9] | ifNull('ms')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{bR[9] | ifNull('ms')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{cR[9] | ifNull('ms')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{dR[9] | ifNull('ms')}}</div></van-col>
          </van-row>
          <van-row gutter="10" class="rowH2">
            <van-col span="4">To:</van-col>
            <van-col span="5"><div class="ipt">{{aR[10] | ifNull('ms')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{bR[10] | ifNull('ms')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{cR[10] | ifNull('ms')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{dR[10] | ifNull('ms')}}</div></van-col>
          </van-row>
          <van-row gutter="10" class="rowH2">
            <van-col span="4">Result:</van-col>
            <van-col span="5"><div class="ipt">{{aR[11] | ifNull}}</div></van-col>
            <van-col span="5"><div class="ipt">{{bR[11] | ifNull}}</div></van-col>
            <van-col span="5"><div class="ipt">{{cR[11] | ifNull}}</div></van-col>
            <van-col span="5"><div class="ipt">{{dR[11] | ifNull}}</div></van-col>
          </van-row>
        </van-collapse-item>
        <van-collapse-item title="Phase S" name="2">
          <van-row class="rowH">
            <van-col span="4">Items:</van-col>
            <van-col span="5">59.S1</van-col>
            <van-col span="5">59.S2</van-col>
            <van-col span="5">27.S1</van-col>
            <van-col span="5">27.S2</van-col>
          </van-row>
          <van-row gutter="10" class="rowH2">
            <van-col span="4">Vt:</van-col>
            <van-col span="5"><div class="ipt">{{aS[0] | ifNull('V')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{bS[0] | ifNull('V')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{cS[0] | ifNull('V')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{dS[0] | ifNull('V')}}</div></van-col>
          </van-row>
          <van-row gutter="10" class="rowH2">
            <van-col span="4">Vs:</van-col>
            <van-col span="5"><div class="ipt">{{aS[1] | ifNull('V')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{bS[1] | ifNull('V')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{cS[1] | ifNull('V')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{dS[1] | ifNull('V')}}</div></van-col>
          </van-row>
          <van-row gutter="10" class="rowH2">
            <van-col span="4">Vo:</van-col>
            <van-col span="5"><div class="ipt">{{aS[2] | ifNull('V')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{bS[2] | ifNull('V')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{cS[2] | ifNull('V')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{dS[2] | ifNull('V')}}</div></van-col>
          </van-row>
          <van-row gutter="10" class="rowH2">
            <van-col span="4">Tt:</van-col>
            <van-col span="5"><div class="ipt">{{aS[3] | ifNull('s')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{bS[3] | ifNull('ms')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{cS[3] | ifNull('ms')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{dS[3] | ifNull('ms')}}</div></van-col>
          </van-row>
          <van-row gutter="10" class="rowH2">
            <van-col span="4">To:</van-col>
            <van-col span="5"><div class="ipt">{{aS[4] | ifNull('s')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{bS[4] | ifNull('ms')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{cS[4] | ifNull('ms')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{dS[4] | ifNull('ms')}}</div></van-col>
          </van-row>
          <van-row gutter="10" class="rowH2">
            <van-col span="4">Result:</van-col>
            <van-col span="5"><div class="ipt">{{aS[5] | ifNull}}</div></van-col>
            <van-col span="5"><div class="ipt">{{bS[5] | ifNull}}</div></van-col>
            <van-col span="5"><div class="ipt">{{cS[5] | ifNull}}</div></van-col>
            <van-col span="5"><div class="ipt">{{dS[5] | ifNull}}</div></van-col>
          </van-row>
          <van-divider :style="{borderColor: '#848F88'}"></van-divider>
          <van-row class="rowH">
            <van-col span="4">Items:</van-col>
            <van-col span="5">81&gt;.S1</van-col>
            <van-col span="5">81&lt;.S1</van-col>
            <van-col span="5">81&gt;.S2</van-col>
            <van-col span="5">81&lt;.S2</van-col>
          </van-row>
          <van-row gutter="10" class="rowH2">
            <van-col span="4">Ft:</van-col>
            <van-col span="5"><div class="ipt">{{aS[6] | ifNull('Hz')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{bS[6] | ifNull('Hz')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{cS[6] | ifNull('Hz')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{dS[6] | ifNull('Hz')}}</div></van-col>
          </van-row>
          <van-row gutter="10" class="rowH2">
            <van-col span="4">Fs:</van-col>
            <van-col span="5"><div class="ipt">{{aS[7] | ifNull('Hz')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{bS[7] | ifNull('Hz')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{cS[7] | ifNull('Hz')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{dS[7] | ifNull('Hz')}}</div></van-col>
          </van-row>
          <van-row gutter="10" class="rowH2">
            <van-col span="4">Fo:</van-col>
            <van-col span="5"><div class="ipt">{{aS[8] | ifNull('Hz')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{bS[8] | ifNull('Hz')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{cS[8] | ifNull('Hz')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{dS[8] | ifNull('Hz')}}</div></van-col>
          </van-row>
          <van-row gutter="10" class="rowH2">
            <van-col span="4">Tt:</van-col>
            <van-col span="5"><div class="ipt">{{aS[9] | ifNull('ms')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{bS[9] | ifNull('ms')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{cS[9] | ifNull('ms')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{dS[9] | ifNull('ms')}}</div></van-col>
          </van-row>
          <van-row gutter="10" class="rowH2">
            <van-col span="4">To:</van-col>
            <van-col span="5"><div class="ipt">{{aS[10] | ifNull('ms')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{bS[10] | ifNull('ms')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{cS[10] | ifNull('ms')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{dS[10] | ifNull('ms')}}</div></van-col>
          </van-row>
          <van-row gutter="10" class="rowH2">
            <van-col span="4">Result:</van-col>
            <van-col span="5"><div class="ipt">{{aS[11] | ifNull}}</div></van-col>
            <van-col span="5"><div class="ipt">{{bS[11] | ifNull}}</div></van-col>
            <van-col span="5"><div class="ipt">{{cS[11] | ifNull}}</div></van-col>
            <van-col span="5"><div class="ipt">{{dS[11] | ifNull}}</div></van-col>
          </van-row>
        </van-collapse-item>
        <van-collapse-item title="Phase T" name="3">
          <van-row class="rowH">
            <van-col span="4">Items:</van-col>
            <van-col span="5">59.S1</van-col>
            <van-col span="5">59.S2</van-col>
            <van-col span="5">27.S1</van-col>
            <van-col span="5">27.S2</van-col>
          </van-row>
          <van-row gutter="10" class="rowH2">
            <van-col span="4">Vt:</van-col>
            <van-col span="5"><div class="ipt">{{aT[0] | ifNull('V')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{bT[0] | ifNull('V')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{cT[0] | ifNull('V')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{dT[0] | ifNull('V')}}</div></van-col>
          </van-row>
          <van-row gutter="10" class="rowH2">
            <van-col span="4">Vs:</van-col>
            <van-col span="5"><div class="ipt">{{aT[1] | ifNull('V')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{bT[1] | ifNull('V')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{cT[1] | ifNull('V')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{dT[1] | ifNull('V')}}</div></van-col>
          </van-row>
          <van-row gutter="10" class="rowH2">
            <van-col span="4">Vo:</van-col>
            <van-col span="5"><div class="ipt">{{aT[2] | ifNull('V')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{bT[2] | ifNull('V')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{cT[2] | ifNull('V')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{dT[2] | ifNull('V')}}</div></van-col>
          </van-row>
          <van-row gutter="10" class="rowH2">
            <van-col span="4">Tt:</van-col>
            <van-col span="5"><div class="ipt">{{aT[3] | ifNull('s')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{bT[3] | ifNull('ms')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{cT[3] | ifNull('ms')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{dT[3] | ifNull('ms')}}</div></van-col>
          </van-row>
          <van-row gutter="10" class="rowH2">
            <van-col span="4">To:</van-col>
            <van-col span="5"><div class="ipt">{{aT[4] | ifNull('s')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{bT[4] | ifNull('ms')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{cT[4] | ifNull('ms')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{dT[4] | ifNull('ms')}}</div></van-col>
          </van-row>
          <van-row gutter="10" class="rowH2">
            <van-col span="4">Result:</van-col>
            <van-col span="5"><div class="ipt">{{aT[5] | ifNull}}</div></van-col>
            <van-col span="5"><div class="ipt">{{bT[5] | ifNull}}</div></van-col>
            <van-col span="5"><div class="ipt">{{cT[5] | ifNull}}</div></van-col>
            <van-col span="5"><div class="ipt">{{dT[5] | ifNull}}</div></van-col>
          </van-row>
          <van-divider :style="{borderColor: '#848F88'}"></van-divider>
          <van-row class="rowH">
            <van-col span="4">Items:</van-col>
            <van-col span="5">81&gt;.S1</van-col>
            <van-col span="5">81&lt;.S1</van-col>
            <van-col span="5">81&gt;.S2</van-col>
            <van-col span="5">81&lt;.S2</van-col>
          </van-row>
          <van-row gutter="10" class="rowH2">
            <van-col span="4">Ft:</van-col>
            <van-col span="5"><div class="ipt">{{aT[6] | ifNull('Hz')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{bT[6] | ifNull('Hz')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{cT[6] | ifNull('Hz')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{dT[6] | ifNull('Hz')}}</div></van-col>
          </van-row>
          <van-row gutter="10" class="rowH2">
            <van-col span="4">Fs:</van-col>
            <van-col span="5"><div class="ipt">{{aT[7] | ifNull('Hz')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{bT[7] | ifNull('Hz')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{cT[7] | ifNull('Hz')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{dT[7] | ifNull('Hz')}}</div></van-col>
          </van-row>
          <van-row gutter="10" class="rowH2">
            <van-col span="4">Fo:</van-col>
            <van-col span="5"><div class="ipt">{{aT[8] | ifNull('Hz')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{bT[8] | ifNull('Hz')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{cT[8] | ifNull('Hz')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{dT[8] | ifNull('Hz')}}</div></van-col>
          </van-row>
          <van-row gutter="10" class="rowH2">
            <van-col span="4">Tt:</van-col>
            <van-col span="5"><div class="ipt">{{aT[9] | ifNull('ms')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{bT[9] | ifNull('ms')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{cT[9] | ifNull('ms')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{dT[9] | ifNull('ms')}}</div></van-col>
          </van-row>
          <van-row gutter="10" class="rowH2">
            <van-col span="4">To:</van-col>
            <van-col span="5"><div class="ipt">{{aT[10] | ifNull('ms')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{bT[10] | ifNull('ms')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{cT[10] | ifNull('ms')}}</div></van-col>
            <van-col span="5"><div class="ipt">{{dT[10] | ifNull('ms')}}</div></van-col>
          </van-row>
          <van-row gutter="10" class="rowH2">
            <van-col span="4">Result:</van-col>
            <van-col span="5"><div class="ipt">{{aT[11] | ifNull}}</div></van-col>
            <van-col span="5"><div class="ipt">{{bT[11] | ifNull}}</div></van-col>
            <van-col span="5"><div class="ipt">{{cT[11] | ifNull}}</div></van-col>
            <van-col span="5"><div class="ipt">{{dT[11] | ifNull}}</div></van-col>
          </van-row>
        </van-collapse-item>
      </van-collapse>
    </div>
  </div>
</template>

<script>
import { Dialog } from 'vant';
export default {
  data() {
    return {
      from:sessionStorage.getItem('setFrom'),
      activeNames:[],
      aR:[],
      bR:[],
      cR:[],
      dR:[],
      aS:[],
      bS:[],
      cS:[],
      dS:[],
      aT:[],
      bT:[],
      cT:[],
      dT:[],
      timer:'',
      myMinute:0,
      mySecond:0,
      inverterType:localStorage.getItem('inverterType')
    };
  },
  methods: {
    onClickLeft() {
      this.$router.push({ path: this.from});
    },
    reset(){
      clearInterval(this.timer);
      this.myMinute=0;
      this.mySecond=0;
      this.startTest();
    },
    setTimer() {
      if(this.timer == null) {
        this.timer = setInterval( () => {
          this.mySecond++;
          if(this.mySecond==60){
            this.mySecond=0;
            this.myMinute++;
          }
        }, 1000);
      }
    },
    //第2步
    step2(arr){
      this.bR[0]=arr[3];
      this.bR[1]=arr[5];
      this.bR[2]=arr[6];
      this.bR[3]=arr[4];
      this.bR[4]=arr[7];
      this.bR[5]="Pass";
      if(this.inverterType==5||this.inverterType==6||this.inverterType==7||this.inverterType==14||this.inverterType==16){
        this.bS[0]=arr[3];
        this.bS[1]=arr[8];
        this.bS[2]=arr[9];
        this.bS[3]=arr[4];
        this.bS[4]=arr[10];
        this.bS[5]="Pass";
        this.bT[0]=arr[3];
        this.bT[1]=arr[11];
        this.bT[2]=arr[12];
        this.bT[3]=arr[4];
        this.bT[4]=arr[13];
        this.bT[5]="Pass";
      }
    },
    //第3步
    step3(arr){
      this.cR[0]=arr[14];
      this.cR[1]=arr[16];
      this.cR[2]=arr[17];
      this.cR[3]=arr[15];
      this.cR[4]=arr[18];
      this.cR[5]="Pass";
      if(this.inverterType==5||this.inverterType==6||this.inverterType==7||this.inverterType==14||this.inverterType==16){
        this.cS[0]=arr[14];
        this.cS[1]=arr[19];
        this.cS[2]=arr[20];
        this.cS[3]=arr[15];
        this.cS[4]=arr[21];
        this.cS[5]="Pass";
        this.cT[0]=arr[14];
        this.cT[1]=arr[22];
        this.cT[2]=arr[23];
        this.cT[3]=arr[15];
        this.cT[4]=arr[24];
        this.cT[5]="Pass";
      }
    },
    //第4步
    step4(arr){
      this.dR[0]=arr[25];
      this.dR[1]=arr[27];
      this.dR[2]=arr[28];
      this.dR[3]=arr[26];
      this.dR[4]=arr[29];
      this.dR[5]="Pass";
      if(this.inverterType==5||this.inverterType==6||this.inverterType==7||this.inverterType==14||this.inverterType==16){
        this.dS[0]=arr[25];
        this.dS[1]=arr[30];
        this.dS[2]=arr[31];
        this.dS[3]=arr[26];
        this.dS[4]=arr[32];
        this.dS[5]="Pass";
        this.dT[0]=arr[25];
        this.dT[1]=arr[33];
        this.dT[2]=arr[34];
        this.dT[3]=arr[26];
        this.dT[4]=arr[35];
        this.dT[5]="Pass";
      }
    },
    //第5步
    step5(arr){
      this.aR[6]=arr[36];
      this.aR[7]=arr[38];
      this.aR[8]=arr[39];
      this.aR[9]=arr[37];
      this.aR[10]=arr[40];
      this.aR[11]="Pass";
      if(this.inverterType==5||this.inverterType==6||this.inverterType==7||this.inverterType==14||this.inverterType==16){
        this.aS[6]=arr[36];
        this.aS[7]=arr[41];
        this.aS[8]=arr[42];
        this.aS[9]=arr[37];
        this.aS[10]=arr[43];
        this.aS[11]="Pass";
        this.aT[6]=arr[36];
        this.aT[7]=arr[44];
        this.aT[8]=arr[45];
        this.aT[9]=arr[37];
        this.aT[10]=arr[46];
        this.aT[11]="Pass";
      }
    },
    //第6步
    step6(arr){
      this.bR[6]=arr[47];
      this.bR[7]=arr[49];
      this.bR[8]=arr[50];
      this.bR[9]=arr[48];
      this.bR[10]=arr[51];
      this.bR[11]="Pass";
      if(this.inverterType==5||this.inverterType==6||this.inverterType==7||this.inverterType==14||this.inverterType==16){
        this.bS[6]=arr[47];
        this.bS[7]=arr[52];
        this.bS[8]=arr[53];
        this.bS[9]=arr[48];
        this.bS[10]=arr[54];
        this.bS[11]="Pass";
        this.bT[6]=arr[47];
        this.bT[7]=arr[55];
        this.bT[8]=arr[56];
        this.bT[9]=arr[48];
        this.bT[10]=arr[57];
        this.bT[11]="Pass";
      }
    },
    //第7步
    step7(arr){
      this.cR[6]=arr[58];
      this.cR[7]=arr[60];
      this.cR[8]=arr[61];
      this.cR[9]=arr[59];
      this.cR[10]=arr[62];
      this.cR[11]="Pass";
      if(this.inverterType==5||this.inverterType==6||this.inverterType==7||this.inverterType==14||this.inverterType==16){
        this.cS[6]=arr[58];
        this.cS[7]=arr[63];
        this.cS[8]=arr[64];
        this.cS[9]=arr[59];
        this.cS[10]=arr[65];
        this.cS[11]="Pass";
        this.cT[6]=arr[58];
        this.cT[7]=arr[66];
        this.cT[8]=arr[67];
        this.cT[9]=arr[59];
        this.cT[10]=arr[68];
        this.cT[11]="Pass";
      }
    },
    //第8步
    step8(arr){
      this.dR[6]=arr[69];
      this.dR[7]=arr[71];
      this.dR[8]=arr[72];
      this.dR[9]=arr[70];
      this.dR[10]=arr[73];
      this.dR[11]="Pass";
      if(this.inverterType==5||this.inverterType==6||this.inverterType==7||this.inverterType==14||this.inverterType==16){
        this.dS[6]=arr[69];
        this.dS[7]=arr[74];
        this.dS[8]=arr[75];
        this.dS[9]=arr[70];
        this.dS[10]=arr[76];
        this.dS[11]="Pass";
        this.dT[6]=arr[69];
        this.dT[7]=arr[77];
        this.dT[8]=arr[78];
        this.dT[9]=arr[70];
        this.dT[10]=arr[79];
        this.dT[11]="Pass";
      }
    },
    //第9步
    step9(arr){
      this.aR[0]=arr[80];
      this.aR[1]=arr[82];
      this.aR[2]=arr[83];
      this.aR[3]=arr[81];
      this.aR[4]=arr[84];
      this.aR[5]="Pass";
      if(this.inverterType==5||this.inverterType==6||this.inverterType==7||this.inverterType==14||this.inverterType==16){
        this.aS[0]=arr[80];
        this.aS[1]=arr[85];
        this.aS[2]=arr[86];
        this.aS[3]=arr[81];
        this.aS[4]=arr[87];
        this.aS[5]="Pass";
        this.aT[0]=arr[80];
        this.aT[1]=arr[88];
        this.aT[2]=arr[89];
        this.aT[3]=arr[81];
        this.aT[4]=arr[90];
        this.aT[5]="Pass";
      }
    },
    //安规自检
    async testSafety(){
      this.comm.loadingShow();
      let datas = await this.SETAPI.SafetyTest({'optType':'SelfTestRequest','pwd':sessionStorage.getItem('bdPwd')});
      if(datas!=null||datas!=undefined){
        let arr=datas['data'];
        let testNum=arr[0];
        if(testNum==2){
          this.step2(arr);
        }else if(testNum==3){
          this.step2(arr);
          this.step3(arr);
        }else if(testNum==4){
          this.step2(arr);
          this.step3(arr);
          this.step4(arr);
        }else if(testNum==5){
          this.step2(arr);
          this.step3(arr);
          this.step4(arr);
          this.step5(arr);
        }else if(testNum==6){
          this.step2(arr);
          this.step3(arr);
          this.step4(arr);
          this.step5(arr);
          this.step6(arr);
        }else if(testNum==7){
          this.step2(arr);
          this.step3(arr);
          this.step4(arr);
          this.step5(arr);
          this.step6(arr);
          this.step7(arr);
        }else if(testNum==8){
          this.step2(arr);
          this.step3(arr);
          this.step4(arr);
          this.step5(arr);
          this.step6(arr);
          this.step7(arr);
          this.step8(arr);
        }else if(testNum==9){
          this.step2(arr);
          this.step3(arr);
          this.step4(arr);
          this.step5(arr);
          this.step6(arr);
          this.step7(arr);
          this.step8(arr);
          this.step9(arr);
          clearInterval(this.timer);
          //弹出框跳转
          Dialog.confirm({
            title: 'Tip',
            message: 'Test completed,please check results!',
          }).then(() => {
              this.$router.push({path:'/bdtestresult'});
            }).catch(() => {
              // on cancel
            });
        }
      }else{
        clearInterval(this.timer);
        this.comm.tipsShow('InvNoResponse');
      }
    },
    //发起安规测试指令
    async startTest(){
      this.comm.loadingShow();
      let data = await this.SETAPI.LocalIn({'optType':'SelfTestStart','Value':10,'pwd':sessionStorage.getItem('bdPwd')});
      let newdata=data.substring(0,1);
      if(newdata == "Y"){
        this.setTimer();
        this.testSafety().catch(()=>{
          clearInterval(this.timer);
          this.comm.tipsShow('InvNoResponse');
        });
      }else{
        this.comm.tipsShow('InvNoResponse');
      }
    }
  },
  mounted() {
    setTimeout(()=>{
      this.startTest();
    },1000);
  },
  created: function() {
    // 每次进入界面时，先清除之前的所有定时器
    clearInterval(this.timer);
    this.myMinute=0;
    this.mySecond=0;
    this.timer = null;
  },
  destroyed: function () {
    // 每次离开当前界面时，清除定时器
    clearInterval(this.timer);
    this.myMinute=0;
    this.mySecond=0;
    this.timer = null;
  }
};
</script>

<style scoped lang="less">
.timeBox{
  background: #fff;
  height: 40px;
  padding: 0 10px;
  line-height: 40px;
  display:flex;
  justify-content: space-between;
}
.rowH{
  height: 32px;
  line-height: 32px;
  text-align: center;
}
.rowH2{
  height: 40px;
  line-height: 40px;
  text-align: center;
}
.ipt{
  width: 98%;
  height: 30px;
  line-height: 30px;
  border: 1px solid #848F88;
  text-align: center;
  margin: 5px 0 0 0;
}
.selftest_h{
  width: 100%; 
  height: 1px; 
  border-top: 1px dashed #161817;
  padding: 10px 0;
}
.col-test{color: #161817; text-align: center; font-weight: bold;}
.col-input{width: 95%; height: 25px; border: 1px solid #848F88;}
input.selftestInput{width: 100%; height: 23px; text-align: center;}

</style>
